package Accessors;

import Callbacks.AbstractCallback;
import Models.Loss;
import Presenter.LossPresenter;
import android.app.ProgressDialog;
import android.content.Context;

@SuppressWarnings("rawtypes")
public class LossAccessor extends AbstractAccessor<Loss,LossPresenter,AbstractCallback> {
	private final String NAME = "losslog";
	private final String DIALOG = "Loss(es)";
	
	private final static LossPresenter presenter = new LossPresenter();
	
	//Modal dialog variable.
	ProgressDialog modalDialog = null;
	
	public LossAccessor(AbstractCallback callback){
		super(presenter, callback);
	}
	
	//Public access functions.
	public void getAllItems(final Context context){
		String dialog = "Loading " + DIALOG + " List...";
		String rfString = NAME;
		super.getAllItems(context, dialog, rfString);
	}
	
	public void getItem(final int id, final Context context){
		String dialog = "Loading " + DIALOG + "...";
		String rfString = NAME + "/" + Integer.toString(id);
		super.getItem(context, dialog, rfString);
	}
	
	public void doItemUpdate(final Loss item, final Context context){
		String dialog = "Updating " + DIALOG + "...";
		String rfString = NAME;
		super.doItemUpdate(item, context, dialog, rfString);
	}
	
	public void doItemInsert(final Loss item, final Context context){
		String dialog = "Inserting " + DIALOG + "...";
		String rfString = NAME;
		super.doItemInsert(item, context, dialog, rfString);
	}
	
	public void doFGILoss(final int fgiID, final int fgiQty, final Loss item, final Context context){
		String dialog = "Inserting " + DIALOG + "...";
		String rfString = NAME + "/doFGILoss/" + Integer.toString(fgiID) + "/" + Integer.toString(fgiQty);
		super.doItemInsert(item, context, dialog, rfString);
	}
	
	public void doCellarLoss(final int brewID, final double volume, final Loss item, final Context context){
		String dialog = "Inserting " + DIALOG + "...";
		String rfString = NAME + "/doCellarLoss/" + Integer.toString(brewID) + "/" + Double.toString(volume);
		super.doItemInsert(item, context, dialog, rfString);
	}
	
	public void doBarrelLoss(final int barrelID, final Loss item, final Context context){
		String dialog = "Inserting " + DIALOG + "...";
		String rfString = NAME + "/doBarrelLoss/" + Integer.toString(barrelID);
		super.doItemInsert(item, context, dialog, rfString);
	}
	
	public void doFirkinLoss(final int firkinID, final Loss item, final Context context){
		String dialog = "Inserting " + DIALOG + "...";
		String rfString = NAME + "/doFirkinLoss/" + Integer.toString(firkinID);
		super.doItemInsert(item, context, dialog, rfString);
	}
}
